using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication11.Models.Mapping
{
    public class Patient_ViewMap : EntityTypeConfiguration<Patient_View>
    {
        public Patient_ViewMap()
        {
            // Primary Key
            this.HasKey(t => new { t.d_w_age_id, t.source_id, t.init_bp_level_seq });

            // Properties
            this.Property(t => t.patient_id)
                .HasMaxLength(20);

            this.Property(t => t.new_id)
                .IsFixedLength()
                .HasMaxLength(4);

            this.Property(t => t.name)
                .HasMaxLength(30);

            this.Property(t => t.join_group_type)
                .HasMaxLength(50);

            this.Property(t => t.disease_chf)
                .HasMaxLength(1);

            this.Property(t => t.disease_stoke)
                .HasMaxLength(1);

            this.Property(t => t.disease_diabetes)
                .HasMaxLength(1);

            this.Property(t => t.disease_other)
                .HasMaxLength(1);

            this.Property(t => t.disease_none_of_above)
                .HasMaxLength(1);

            this.Property(t => t.disease_unknown)
                .HasMaxLength(1);

            this.Property(t => t.disease_not_answer)
                .HasMaxLength(1);

            this.Property(t => t.disease_cardiac_intervention)
                .HasMaxLength(1);

            this.Property(t => t.disease_retinopathy)
                .HasMaxLength(1);

            this.Property(t => t.disease_heart_failure)
                .HasMaxLength(1);

            this.Property(t => t.disease_dissecting_aneurysm)
                .HasMaxLength(1);

            this.Property(t => t.disease_tumour)
                .HasMaxLength(1);

            this.Property(t => t.family_history_hypertension)
                .HasMaxLength(1);

            this.Property(t => t.family_history_chf)
                .HasMaxLength(1);

            this.Property(t => t.family_history_stroke)
                .HasMaxLength(1);

            this.Property(t => t.family_history_diabetes)
                .HasMaxLength(1);

            this.Property(t => t.family_history_other)
                .HasMaxLength(1);

            this.Property(t => t.family_history_none_of_above)
                .HasMaxLength(1);

            this.Property(t => t.family_history_unknown)
                .HasMaxLength(1);

            this.Property(t => t.family_history_not_answer)
                .HasMaxLength(1);

            this.Property(t => t.doctor_id)
                .HasMaxLength(20);

            this.Property(t => t.d_w_age_id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.age_desc)
                .HasMaxLength(20);

            this.Property(t => t.gender_name)
                .HasMaxLength(50);

            this.Property(t => t.gender_en)
                .HasMaxLength(50);

            this.Property(t => t.group_name)
                .HasMaxLength(50);

            this.Property(t => t.patient_group_en)
                .HasMaxLength(50);

            this.Property(t => t.create_by)
                .HasMaxLength(20);

            this.Property(t => t.update_by)
                .HasMaxLength(20);

            this.Property(t => t.source_id)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.init_bp_level_seq)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.init_bp_level_cn)
                .HasMaxLength(50);

            this.Property(t => t.init_bp_level_en)
                .HasMaxLength(20);

            this.Property(t => t.init_framingham_score_cn)
                .HasMaxLength(50);

            this.Property(t => t.init_framingham_score_en)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("Patient_View");
            this.Property(t => t.patient_id).HasColumnName("patient_id");
            this.Property(t => t.new_id).HasColumnName("new_id");
            this.Property(t => t.name).HasColumnName("name");
            this.Property(t => t.join_group_type).HasColumnName("join_group_type");
            this.Property(t => t.disease_chf).HasColumnName("disease_chf");
            this.Property(t => t.disease_stoke).HasColumnName("disease_stoke");
            this.Property(t => t.disease_diabetes).HasColumnName("disease_diabetes");
            this.Property(t => t.disease_other).HasColumnName("disease_other");
            this.Property(t => t.disease_none_of_above).HasColumnName("disease_none_of_above");
            this.Property(t => t.disease_unknown).HasColumnName("disease_unknown");
            this.Property(t => t.disease_not_answer).HasColumnName("disease_not_answer");
            this.Property(t => t.disease_cardiac_intervention).HasColumnName("disease_cardiac_intervention");
            this.Property(t => t.disease_retinopathy).HasColumnName("disease_retinopathy");
            this.Property(t => t.disease_heart_failure).HasColumnName("disease_heart_failure");
            this.Property(t => t.disease_dissecting_aneurysm).HasColumnName("disease_dissecting_aneurysm");
            this.Property(t => t.disease_tumour).HasColumnName("disease_tumour");
            this.Property(t => t.family_history_hypertension).HasColumnName("family_history_hypertension");
            this.Property(t => t.family_history_chf).HasColumnName("family_history_chf");
            this.Property(t => t.family_history_stroke).HasColumnName("family_history_stroke");
            this.Property(t => t.family_history_diabetes).HasColumnName("family_history_diabetes");
            this.Property(t => t.family_history_other).HasColumnName("family_history_other");
            this.Property(t => t.family_history_none_of_above).HasColumnName("family_history_none_of_above");
            this.Property(t => t.family_history_unknown).HasColumnName("family_history_unknown");
            this.Property(t => t.family_history_not_answer).HasColumnName("family_history_not_answer");
            this.Property(t => t.doctor_id).HasColumnName("doctor_id");
            this.Property(t => t.node_id).HasColumnName("node_id");
            this.Property(t => t.birth_date).HasColumnName("birth_date");
            this.Property(t => t.age).HasColumnName("age");
            this.Property(t => t.current_age).HasColumnName("current_age");
            this.Property(t => t.d_w_age_id).HasColumnName("d_w_age_id");
            this.Property(t => t.age_desc).HasColumnName("age_desc");
            this.Property(t => t.gender_id).HasColumnName("gender_id");
            this.Property(t => t.gender_name).HasColumnName("gender_name");
            this.Property(t => t.gender_en).HasColumnName("gender_en");
            this.Property(t => t.patient_group_id).HasColumnName("patient_group_id");
            this.Property(t => t.group_name).HasColumnName("group_name");
            this.Property(t => t.patient_group_en).HasColumnName("patient_group_en");
            this.Property(t => t.patient_status).HasColumnName("patient_status");
            this.Property(t => t.logout_time).HasColumnName("logout_time");
            this.Property(t => t.create_by).HasColumnName("create_by");
            this.Property(t => t.create_time).HasColumnName("create_time");
            this.Property(t => t.update_by).HasColumnName("update_by");
            this.Property(t => t.update_time).HasColumnName("update_time");
            this.Property(t => t.source_id).HasColumnName("source_id");
            this.Property(t => t.init_bp_level_seq).HasColumnName("init_bp_level_seq");
            this.Property(t => t.init_bp_level_cn).HasColumnName("init_bp_level_cn");
            this.Property(t => t.init_bp_level_en).HasColumnName("init_bp_level_en");
            this.Property(t => t.init_framingham_score_id).HasColumnName("init_framingham_score_id");
            this.Property(t => t.init_framingham_score_cn).HasColumnName("init_framingham_score_cn");
            this.Property(t => t.init_framingham_score_en).HasColumnName("init_framingham_score_en");
        }
    }
}
